package cn.exrick.xboot.modules.downloadResources.serviceimpl;

import cn.exrick.xboot.modules.downloadResources.dao.mapper.DownloadResourcesMapper;
import cn.exrick.xboot.modules.downloadResources.entity.DownloadResources;
import cn.exrick.xboot.modules.downloadResources.service.IDownloadResourcesService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * 常用资源下载链接接口实现
 * @author Exrick
 */
@Slf4j
@Service
@Transactional
public class IDownloadResourcesServiceImpl extends ServiceImpl<DownloadResourcesMapper, DownloadResources> implements IDownloadResourcesService {

    @Autowired
    private DownloadResourcesMapper downloadResourcesMapper;

    /**
     * 20190724
     * njp
     * 新增常用下载资源分页的条件查询(使用map作为条件的载体)
     * map 为参数
     */
    public IPage<DownloadResources> selectDownloadResourcesPageVoMap(Page page, @Param("map") Map<String,Object> map){
        return downloadResourcesMapper.selectDownloadResourcesPageVoMap(page,map);
    }
    /**
     * 获取num数量数据并区分用户组织结构
     * @param map
     * @return
     */
    public List<DownloadResources> selectDownloadResourcesByNumAndDep( @Param("map") Map<String,Object> map){
        return downloadResourcesMapper.selectDownloadResourcesByNumAndDep(map);
    }

}